/*************************************************
//  parse a string to some tokens
//  write: xinjian zhang
//  data: 2011/5/10
*************************************************/
#pragma once

class CTokenParser
{
private:
    CString source;
    char buffer[100];
    char delimit;
    const char *p;
    char *pbuf;
public:
    void Parse(const CString &source)
    {
        this->source = source;
        p = (LPCSTR)this->source;
    }
    CString GetNextToken()
    {
        //memset( buffer, 0, sizeof(buffer) );
        pbuf = buffer;
        while ( *p != delimit && *p != '\0') { *pbuf++ = *p++; }
        p++;
        *pbuf = '\0';
        return buffer;
    }
public:

    CTokenParser(const char delimit)
    {
        this->delimit = delimit; 
    }

    ~CTokenParser(void)
    {
    }
};
